% Copyright, Eduardo Aponte, 2012.

clear classes

% Initilize instnce of ET_COGENT
%--------------------------------------------------------------------------
Exp = ET_COGENT();

% Resolution
%--------------------------------------------------------------------------
Exp.scn.res = 3;

% Screen size
%--------------------------------------------------------------------------
Exp.scn.w = 1024;
Exp.scn.h = 768;

% Amplitud in screen units
%--------------------------------------------------------------------------
Exp.fix.x = -0.75;

% Frequencies
%--------------------------------------------------------------------------
v = [10,14,18,22];
speeds = Exp.scn.refresh_rate * (Exp.scn.wcm/2)./(Exp.view_dist*(v./180));

% Occluder color
%--------------------------------------------------------------------------
Exp.occluder.rgb = [0.8,0.8,0.8];

% Prepare Experiment
%--------------------------------------------------------------------------
Exp.FpClearn = speeds;
Exp.prepareFixation()
Exp.prepareTrialTypes()

% Prepare Experiment
%--------------------------------------------------------------------------
Exp.prepareOccluder(Exp.scn.w*abs(Exp.fix.x)/4,0)
Exp.prepareSpeeds()
Exp.prepareJump()

% Define stimuli trayectory
%--------------------------------------------------------------------------
clear randomSinusWalk

seed = round(rand * 1e+6);
s    = exp(0);                     %Standard deviation

%Exp.stimuli = inline(vectorize(sprintf('real(exp(i*2*pi*(x + exp(%0.2f)*rand(size(x))/f)))',0)),'x','f');

%Exp.stimuli = inline(sprintf('randomSinusWalk(x,f,%0.2f,%i)',s,seed),'x','f');
Exp.stimuli = inline('cos(x*2*pi) + 0.3*cos(3*x*2*pi)','x','f');
% 1 to interface with Eyelink
%--------------------------------------------------------------------------
Exp.Eyelink = 0;

% Initialize Eyelink
%--------------------------------------------------------------------------
Exp.runScreen()
